import request from '@/utils/request'

const base_api = '/admin/system/user'

/**
 * 分页查询用户列表
 * @param {当前页} pageNum
 * @param {每页展示数量} pageSize
 * @param {查询条件} queryDto
 * @returns
 */
export const GetSysUserListByPage = (pageNum, pageSize, queryDto) => {
  return request({
    // url: '/admin/system/user/findByPage/' + pageNum + "/" + pageSize,
    url: `${base_api}/findByPage/${pageNum}/${pageSize}`,
    method: 'post',
    data: queryDto,
  })
}

/**
 * 添加用户
 * @param {系统用户} sysUser
 * @returns
 */
export const SaveSysUser = sysUser => {
  return request({
    url: `${base_api}/saveSysUser`,
    method: 'post',
    data: sysUser,
  })
}

/**
 * 修改用户
 * @param {系统用户} sysUser
 * @returns
 */
export const UpdateSysUser = sysUser => {
  return request({
    url: `${base_api}/updateSysUser`,
    method: 'put',
    data: sysUser,
  })
}

/**
 * 删除用户
 * @param {用户ID} userId
 * @returns
 */
export const DeleteSysUser = userId => {
  return request({
    url: `${base_api}/deleteById/${userId}`,
    method: 'delete',
  })
}

// 给用户分配角色
export const AssignRoleAuth = assginRoleVo => {
  return request({
    url: `${base_api}/assignRoleAuth`,
    method: 'post',
    data: assginRoleVo,
  })
}
